package iosr11.gbase;

import com.google.api.gbase.client.GoogleBaseEntry;
import com.google.gdata.data.DateTime;
import com.google.gdata.data.PlainTextConstruct;

public class MarkBaseImpl implements MarkBase{

	private BaseDAO engine;
	
	public MarkBaseImpl(BaseDAO engine){
		this.engine = engine;
	}

	@Override
	public String addNewMarkReturnId(float grade, String teacherId, int kind,
			DateTime date, float points) {
		GoogleBaseEntry entry = new GoogleBaseEntry();
		entry.setTitle(new PlainTextConstruct("mark"));
		entry.setDraft(true);
		entry.getGoogleBaseAttributes().setItemType("mark");
		entry.getGoogleBaseAttributes().addFloatAttribute("grade", grade);
		entry.getGoogleBaseAttributes().addReferenceAttribute("teacher", teacherId);
		entry.getGoogleBaseAttributes().addIntAttribute("kind", kind);
		entry.getGoogleBaseAttributes().addDateTimeAttribute("date", date);
		entry.getGoogleBaseAttributes().addFloatAttribute("points", points);
		return engine.addRecordReturnId(entry);
	}
	
	
}
